package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.LoginDao;
import com.itheima.pojo.Administrators;
import com.itheima.pojo.User;
import com.itheima.service.LoginService;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = LoginService.class)
@Transactional
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginDao loginDao;
    @Override
    public Administrators login(String name, String password) {
        Administrators a = new Administrators();
        a.setName(name);
        a.setPassword(password);
        Administrators administrators=loginDao.login(a);
        return administrators;
    }

    @Override
    public void register(String user_name, String user_password) {
        Administrators a = new Administrators();
        a.setName(user_name);
        a.setPassword(user_password);
        loginDao.register(a);
    }

    @Override
    public Administrators findByUserName(String name) {
        Administrators a = new Administrators();
        a.setName(name);
        return loginDao.finByUserName(a);
    }
}
